class StartedState implements State {
    @Override
    public void onTemperatureBelow20AndHasWater(WaterTank tank) {
        if (tank.hasWater()) {
            tank.setPowerOn(true);
            System.out.println("开始加热...（温度低于20°C且有水）");
            tank.setCurrentState(new HeatingState());
        } else {
            System.out.println("水箱无水，无法加热。");
            tank.setCurrentState(new NotHeatingState());
        }
    }

    @Override
    public void onTemperatureReached100(WaterTank tank) {}
    @Override
    public void onNoWater(WaterTank tank) {
        tank.setCurrentState(new NotHeatingState());
    }
    @Override
    public void onBurnedOut(WaterTank tank) {
        tank.setIsBurnedOut(true);
        System.out.println("水箱烧坏！系统停止运行。");
    }
    @Override
    public void onMorning7(WaterTank tank) {}
    @Override
    public void onNight11(WaterTank tank) {
        System.out.println("晚上11点，自动断电进入休眠...");
        tank.setPowerOn(false);
        tank.setCurrentState(new UnstartedState());
    }
}